home *** CD-ROM | disk | FTP | other *** search
- August 31, 1987
-
- QWIK SCREEN PROCEDURES
- Version 3.0
-
- PURPOSE:
-
- QWIK screen procedures permit fast screen writing on IBM
- compatibles on any IBM adapter including the new PS/2 systems
- without "snow" or flicker effects and is compatible with ANY
- column format (e.g. 40/80 or variable). Written in Turbo Pascal
- inline assembler, these procedures are lightning fast. The code
- has also been condensed as much as possible without sacrificing
- speed - only 1.5k bytes of compiled code for all 18 procedures!
-
-
- TEST DRIVE:
-
- Compile and run QWIKDEMO.PAS to get a feel for features and speed.
-
-
- IMPROVEMENTS:
-
- In this version, I have updated the initialization procedure to
- accommodate the new IBM PS/2 family of computers as well as the
- PCjr and the PC convertible. Two new cursor procedures were
- added. The module addressing was improved.
-
- After much thought, I have decided to make these procedures into
- ShareWare. The cost may range from $5 to $15 depending on your
- application. I do enjoy assisting others in their programming,
- but lack of reimbursement is expensive for me! Please help out.
- See the license statement in LICENSE.ARC for details. If the
- response will let me break even, I will continue support.
-
-
- PROCEDURES:
-
- In this version, QWIK30.ARC contains:
-
- Qinit .inc: Initializing procedure required to be executed
- first and just once before any Q procedures.
- Qinit .doc: Document for Qinit.inc.
- Qwrites .inc: Five Quick direct screen writing procedures:
- QwriteLV - referenced (VAR) strings, specified
- length and index.
- QwriteV - referenced (VAR) strings
- Qwrite - value strings
- QwriteC - value strings, self-centering
- QwriteCV - referenced (VAR) strings, self-
- centering
- Qfills .inc: Four Quick direct screen filling procedures
- in Rows-by-Cols block parameters:
- QfillC - repetitive filling with the same
- character and self-centering
- Qfill - repetitive filling with the same
- character
- Qattr - repetitive filling with the same
- attribute only
- QattrC - repetitive filling with the same
- attribute and self-centering
- Qstores .inc: Two Quick storing procedures:
- QstoreToMem - Saves a Rows-by-Cols block
- to memory.
- QstoreToScr - Restores a Rows-by-Cols block
- to any screen page.
- Qpage .inc: Two Quick direct screen changing procedures:
- QviewPage - Changes the page to be
- displayed - up to 8!
- QwritePage - Sets the page on which the
- Q procedures are writing. You
- don't have to write just on
- the displayed page!
- Cursor .inc: Four Quick cursor procedures:
- GotoRC - inverse of Turbo's GotoXY
- ChangeCursor - changes shape and visibility
- of the cursor; saves old, too!
- CursorOff - Hides cursor.
- CursorOn - Reveals cursor, again.
- Cursor .doc: Document for Cursor.inc.
- Qwik30 .inc: Has all of the above routines but compiles much
- faster because there are few comments.
- Qwik30 .doc: This document.
- QwikDemo.pas: A demonstration program showing the features and
- speed of all procedures and is written primarily
- for color cards, but also works on MDA.
- Qbench .pas: A timing program that shows "screens/second" for
- the Q procedures.
- Qinitest.pas: A program that verifies the equipment detected
- by Qinit.inc.
- TimerD12.inc: Include file to measure elapsed time.
- License .arc: ARC file containing license agreements
-
-
- PROGRAMMING:
-
- To use the procedures, just simply pick out the ones you need and
- include them in your programs. QINIT.INC must be included first.
- Only one initializing statement is necessary before Q procedures
- are used (not required for cursor.inc):
-
- Qinit;
-
- This procedure automatically configures the procedures to your
- machine and also makes it portable to others. Procedures in
- QWRITES.INC and QFILLS.INC work with or without attributes
- changes.
-
- All of the procedures work with TurboPower's Optimizer programs
- without modification. With TLC, you can use the -C option.
-
-
- MODULES:
-
- The coding has been reduced by making the display loops into a
- subroutine and programming the procedures to access it. These
- were combined to make modules - two in this package. The
- procedures can be placed in the usual order of Pascal protocol.
- The program was written specifically for Turbo 3.0.
-
-
- PARAMETERS:
-
- Row/Col - The procedures do not check for bounds on the screen,
- so be sure to stay in range. The procedures were designed for
- the upper left column on the screen to be 1,1. If you want 0,0,
- refer to MODIFICATIONS below. They also wrap to the next line;
- they do not truncate at EOL. You of course can have something
- like Row:=1 and Col:=255 which is equivalent to Row:=3 and
- Col:=15 on a screen with 80 columns.
-
- ColL/ColR - In QwriteC, QwriteCV, QfillC, and QattrC, the left
- and right columns are simply averaged. To center on the full
- width of an 80 column display, set ColL:=1 and ColR:=80. To
- center on a certain column number, set both values equal to that
- column number.
-
- Rows/Cols - They can be any positive integer to define the block
- - Rows-by-Columns starting at Row, Col. Values <=0 will simply
- abort the procedure. Please keep Cols limited to one row.
-
- Attr - The attributes range from 0 to 255. Values greater than
- 255 will be operated by modulo 256 to stay useful. Negative
- values suppress any changes to the screen attributes and use
- what's currently on the screen. For help with attribute values,
- use Brian Foley's FWATTR.INC on Borland's Programming Forum on
- CompuServe in Turbo Pascal Data Library for MSDOS. You can also
- use Turbo's TextColor and TextBackground procedures, and then
- use an absolute variable assigned at Dseg:8 (see QWIKDEMO.PAS for
- an example).
-
- Length - In QwriteLV, you can write partial strings by specifying
- the Length and starting index (St[i]). All other Qwrite
- procedures assume length is the value at St[0] and the starting
- index is St[1]. Length can be any positive integer.
-
- St - The original type was set for string length of 80 characters
- which my be changed to any value between 1 and 255. Be sure to
- change all type statements to reflect it though!
-
- Source/Dest - For Qstores.inc, this can be a pointer for the heap
- or an array variable. Be sure there is sufficient room. Storage
- requirements are: (Rows * Cols shl 1) which is two bytes for
- every column. For pointers use a format such as:
-
- Var MemPtr: ^byte;
- GetMem (MemPtr,Rows*Cols shl 1);
- QstoreToMem (Row,Col,Rows,Cols,MemPtr^);
-
- Page - The page range depends upon your adapter. See QINIT.DOC
- for the possible ranges.
-
- Order - You may rearrange the parameters in any order you prefer.
- The arrangement was made to facilitate readability and keeping
- the coordinates on the left side of the display.
-
-
- PAGING:
-
- If you have a CGA or better, you already have memory on your card
- for more than the 80x25 display you normally see. The two page
- procedures allow you to use Q screen procedures on these other
- pages and display which ever you choose. However, Turbo's
- procedures such as Write, Window, and GotoXY are dedicated to page
- 0 only. I have included GotoRC as one procedure that works on all
- pages. If you want more procedures for this, refer to Neil
- Rubenking's VIDPAG.PAS on Borland's Programming Forum. Be sure to
- end your programs with "QviewPage (0);".
-
-
- SPEED:
-
- How fast is fast? Well, I thought it would be good idea to have
- some criteria to get a feeling for speed. The units I decided
- to use for comparison are "screens/second". To make one screen,
- a procedure is repeated with a FOR loop to fill several 80x25
- pages and timed. QwriteXX use 80 character strings, and Qattr
- and Qfill use Rows:=25 and Cols:=80. Here are some samples from
- the systems that have been tested. My own computer is the
- AT&T 6300+ which uses Intel 80286. Monochrome (MDA) speeds are
- identical to EGA speeds.
-
- ------------------ S C R E E N S / S E C O N D ------------------
- Chng XT(4.77 MHz) M50 M30 PCC ATT 6300+
- Procedure Attr EGA CGA MCGA VGA LCD EGA CGA
- --------- ---- ------------ ----- ----- ----- -----------
- QwriteLV Yes 32.6 9.5 74.9 88.4 39.7 111.3 16.8
- No 42.0 9.5 89.3 138.1 47.8 119.5 16.8
- QwriteV Yes 32.8 9.5 75.4 88.4 40.0 112.1 16.7
- No 42.4 9.5 90.0 138.1 48.6 119.5 16.8
- Qwrite Yes 24.9 7.2 52.2 74.5 29.1 87.3 14.4
- No 29.7 7.2 58.7 102.7 33.6 92.0 14.4
- QwriteC Yes 24.6 7.2 51.9 74.0 29.0 86.8 14.3
- No 29.6 7.2 58.1 102.7 33.0 90.9 14.4
- QwriteCV Yes 32.6 9.5 74.9 89.0 39.5 111.0 16.8
- No 41.6 9.5 89.3 138.1 47.8 119.0 16.8
- QfillC Yes 81.2 11.9 166.6 147.3 122.5 244.3 21.5
- No 72.6 7.4 141.3 174.4 90.5 176.9 14.0
- Qfill Yes 81.2 11.8 164.1 147.3 122.5 246.1 21.5
- No 73.7 7.4 141.3 174.4 90.5 177.9 14.0
- Qattr Yes 72.6 7.4 141.3 174.4 90.5 177.9 14.0
- QattrC Yes 72.6 7.4 141.3 174.4 90.5 177.9 14.0
- QstoreToMem n/a 59.1 7.2 111.6 127.4 78.4 181.9 13.8
- QstoreToScr n/a 59.1 7.0 111.6 126.2 78.4 183.9 13.7
-
-
- ADDRESSING IN THE MODULES:
-
- Turbo 3.0 compiles some code before and after procedures:
-
- 1. 7 bytes before.
- 2. 7 bytes after without parameters.
- 3. 9 bytes after with parameters.
-
- To keep from changing the stack base pointer, these code bytes are
- bypassed. They are addressed in the inline code as:
-
- call >QwritesDisp-*+5
-
- instead of the usual "...*-2" which is the normal entry location
- for a procedure. Future versions of Turbo may be different and
- the offset value may need to be changed as well as negative
- references to the base pointer such as "[BP-$04]". I will try to
- keep up to date.
-
-
- MODIFICATIONS:
-
- Base Coordinates - If you want to change the upper left corner to
- be 0,0 instead of 1,1, you need to do the following on the inline
- codes described with "Convert to 0-?? range":
-
- 1. In QwriteLV, QwriteV, Qwrite, Qfill, and Qattr replace
- DEC DI with NOP which has an inline code of $90.
- 2. In QwritesDisp and QfillsDisp, delete DEC DX and DEC AX.
- 3. In QwriteC, QwriteCV, QfillC, and QattrC change DEC DI to
- INC DI which has a inline code of $40.
- 4. In QstoreToMem and QstoreToScr, replace DEC AX, DEC SI
- and DEC DI with NOP.
- 5. In GotoRC, delete DEC DH and DEC DL.
-
-
- APPLICATIONS:
-
- Multi-level Windows - An application of QWIK30.INC is multi-level
- windows. The code has already been done in a file called
- WINDOW34.ARC. It creates protected removable windows with
- Macintosh-like special special effects.
-
- Multi-level Pull-down Menus - An application of windows is multi-
- level pull-down menus. I have already created some very thorough
- code in a file called PULL15.ARC. It is fully featured and fully
- configurable. Includes execute, single, and multiple choice
- menus, unlimited nested submenus, data entry windows, help
- windows, directory windows, message system, and fully completed
- interfaces.
-
- On-line source - All updated files can be found on the CompuServe
- Borland Forum (GO BORPRO) in the MSDOS Turbo Pascal Data Library.
-
-
- CREDITS:
-
- Without the assistance and original ideas from Brian Foley
- [76317,3247], these routines would not have been written. In
- addition, Dave Baldwin's InLine Assembler was essential in its
- development.
-
- Copyright (c) 1986,1987 by Jim LeMay
- Even though this is source code, it is still protected by the
- United States Copyright Law.
-
- If there are any problems, please let me know.
- Jim LeMay [76011,217] (1-817-735-4833 after 1800 CST)
- 6341 Klamath Rd., Ft. Worth, TX, 76116.
-
-
- PRICE:
-
- These procedures are now ShareWare and the price may range from $5
- to $15 depending on your application. See STATMENT.LIC in
- LICENSE.ARC for details.
-
-
- APPENDIX:
-
- Quick Reference List of all procedures and parameters:
-
- Qinit;
-
- QwriteLV (Row, Col: byte; Attr, Length: integer; VAR St);
- QwriteV (Row, Col: byte; Attr: integer; VAR St);
- Qwrite (Row, Col: byte; Attr: integer; St: Str80);
- QwriteC (Row, ColL, ColR: byte; Attr: integer; St: Str80);
- QwriteCV (Row, ColL, ColR: byte; Attr: integer; VAR St);
-
- QfillC (Row, ColL, ColR, Rows, Cols: byte; Attr: integer; Ch: char);
- Qfill (Row, Col, Rows, Cols: byte; Attr: integer; Ch: char);
- Qattr (Row, Col, Rows, Cols: byte; Attr: integer);
- QattrC (Row, ColL, ColR, Rows, Cols: byte; Attr: integer);
-
- QstoreToMem (Row, Col, Rows, Cols: byte; VAR Dest);
- QstoreToScr (Row, Col, Rows, Cols: byte; VAR Source);
-
- QviewPage (Page: byte);
- QwritePage (Page: byte);
-
- GotoRC (Row, Col: Byte);
- CursorChange (New: integer; VAR Old: integer);
- CursorOff;
- CursorOn;
-
-
- REVISIONS:
-
- Version 1.1 (10-31-86):
- Improved speed about 15%.
- Corrected segment error for Mono mode.
-
- Version 1.2 (11-04-86):
- Added self-centering routines.
- Added document and complete demo.
-
- Version 1.3 (11-10-86):
- Reduced assembly code 60% by using modules.
- Added CursorChange procedure.
- Improved speed on Qfill and Qattr about 5%.
- Corrected Qfill bug. (Extra characters were added when
- attr<0 and Cols=even.)
- Changed EGA detection to use Mono rather than CGA loops.
- Added page capability to GotoRC.
-
- Version 2.0 (11-24-86):
- Complete revision for global access to paging, retrace, and
- segment address. Permits formats in any column mode (40
- 80,120, or whatever).
- Changed Qfill and Qattr for easier Row-by-Column blocks.
- Added QfillC and QattrC for self-centering.
- Added two page procedures.
- Added two screen memory transfer procedures for Row-by-Column
- blocks.
- Increased speed of Qfill with attribute on CGA by 65%.
-
- Version 2.1 (12-09-86):
- Added QwriteLV for partial string writing.
- Added interrupt enable in QwritesDisp and QfillsDisp at
- the end of writing in the vertical band for color.
- Fixed bug in QstoreToScr to access other segments.
- Modified Qdemo.pas for MDA and any column mode.
- Added Qbench.pas to check speed on your own system.
-
- Version 3.0 (08-31-87):
- Modified Qinit to handle the entire IBM PC family of computers.
- Added the procedures CursorOff and CursorOn.
- Added the document files QINIT.DOC and CURSOR.DOC.
- Improved module addressing, eliminating any precautions of
- location.
- Added QINITEST.PAS to check detection by QINIT.INC.
- Modified QBENCH.PAS for new QINIT.INC.
- Renamed QDEMO.PAS to QWIKDEMO.PAS.